import Vue from 'vue'
import Vuex from 'vuex'
import VuexPersist from 'vuex-persistedstate'
import getFilterRoute from '../router/filterRoute'
import routes from '../router/routes'

Vue.use(Vuex)

export default new Vuex.Store({
  state: {
    userinfo:{}
  },
  getters: {
    getRoute(state){
      return getFilterRoute(routes,state.userinfo.role.permissions)
    }
  },
  mutations: {
    setUser(state,params){
      state.userinfo=params
    }
  },
  actions: {
  },
  modules: {
  },
  plugins:[
    VuexPersist()
  ]
})
